import { createRouter, createWebHistory } from 'vue-router';

// 导入组件
import LoginVue from '@/views/Login.vue'
import LayoutVue from '@/views/Layout.vue'
import ArticleCategoryVue from '@/article/ArticleCategory.vue'
import ArticleManageVue from '@/article/ArticleManage.vue'
import USERavatarVue from '@/user/UserAvatar.vue'
import UserInfoVue from '@/user/UserInfo.vue'
import UserResetPassword from '@/user/UserResetPassword.vue'
// 定义路由关系
const routes = [
    {path:'/login', component: LoginVue},
    {
        path: '/',
        component: LayoutVue,redirect:'/article/manage',
        children: [ // 修正为小写
            {path: '/article/category', component: ArticleCategoryVue},
            {path: '/article/manage', component: ArticleManageVue}, // 修正路径
            {path: '/user/info', component: UserInfoVue},
            {path: '/user/avatar', component: USERavatarVue},
            {path: '/user/resetPassword', component: UserResetPassword}
        ]
    }
]

// 创建路由器
const router = createRouter({
    history: createWebHistory(),
    routes: routes,
   
})

// 到出路由
export default router;